package cn.itsource.ymcc.client;

import cn.itsource.ymcc.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

@Component
public class CourseFeignClientFallbackFactory implements FallbackFactory<CourseFeignClient> {
    @Override
    public CourseFeignClient create(Throwable throwable) {
        return new CourseFeignClient() {
            @Override
            public JsonResult findByCourseId(Long courseId,Long userId) {
                throwable.printStackTrace();
                return JsonResult.error("findByCourseId:"+throwable.getMessage());
            }
        };
    }
}
